{echo:JS::import("form")}
{echo:JS::import('dialog?skin=tinysimple');}
{echo:JS::import('dialogtools');}
<link type="text/css" rel="stylesheet" href="{url:#css/ucenter.css}" />
<style type="text/css">
td{text-align:center;}
</style>
<div class="container clearfix">
	{widget:name=sub_navs action=ucsidebar sidebar=$sidebar act=$actionId}
	<div class="content clearfix uc-content">
	
		
		<div class="mt10 tab">
			<ul class="tab-head">
				<li>我的交易<i></i></li>
				<li>交易明细<i></i></li>
			</ul>
			<div class="tab-body">
				<div>
					<table class="simple">
						<tr>
							<th>时间</th>
							<th>单价</th>
							<th>初始数量</th>
							<th>已卖出</th>
							<th>剩余</th>
							<th>金额</th>
							<th>交易说明</th>
							<th>操作</th>
						</tr>
						{query:name=transaction_sell where=user_id eq $user[id] order=id desc page=1 id=$withdraw}
						<tr class="{if:$key%2==1}odd{else:}even{/if} {if:$item['status']==2}noborder{/if}">
							<td>{$item['create_time']}</td>
							<td>{$item['price']}</td>
							<td>{$item['quantity']}</td>
							<td><b style="color:red;">{echo:$item['quantity']-$item['last_quantity']}</b></td>
							<td>{$item['last_quantity']}</td>
							<td>{echo:$item['price']*$item['last_quantity']}</td>
							<td>{$item['desc']}</td>
							<td>
								{if:$item['status']==0}
									<!-- 
									<a class="btn btn-main" onclick="return go_back_sell(this,{$item['id']})">撤销</a>
									-->
									<input type="button" class="btn btn-main" onclick="return go_back_sell(this,{$item['id']})" value="撤销"/>
								{elseif:$item['status']==1}
									<b style="color:red;">已完成</b>
								{/if}
							</td> 
						</tr>
						{/query}
					</table>
					<div class="page-nav f12">{echo:$withdraw->pagebar()}</div>
				</div>
				
				<div>
					<table class="simple">
						<tr>
							<th>时间</th>
							<th>单价</th>
							<th>数量</th>
							<th>金额</th>
							<th>反哺费</th>
							<th>实际到帐</th>
							<th>交易类型</th><!-- 买入 或者 卖出 --> 
							 
						</tr>
						{query:name=transaction_buy where=user_id eq $user[id] or seller_id eq $user[id] order=id desc page=1 id=$withdraw}
						{if:$item['seller_id']==$user[id]}
						
						<tr class="{if:$key%2==1}odd{else:}even{/if} {if:$item['status']==2}noborder{/if}">
							<td>{$item['create_time']}</td>
							<td>{$item['price']}</td>
							<td>{$item['quantity']}</td>
							<td>{$item['buy_dz_je']}</td>
							<td>
								<!-- 只有卖出时才显示反哺费 -->
								{$item['fbf_je']}
								
							</td>
							<td>
								{$item['sell_dz_je']}
								
							</td>
							<td>
								
								卖出
							</td>
							 
						</tr>
						{/if}
						{if:$item['user_id']==$user[id]}
						<tr class="{if:$key%2==1}odd{else:}even{/if} {if:$item['status']==2}noborder{/if}">
							<td>{$item['create_time']}</td>
							<td>{$item['price']}</td>
							<td>{$item['quantity']}</td>
							<td>{$item['buy_dz_je']}</td>
							<td>
								<!-- 只有卖出时才显示反哺费 -->
								0.00
							</td>
							<td>
								{$item['buy_dz_je']}
							</td>
							<td>
								
								买入
							</td>
							 
						</tr>
						{/if}
						{/query}
					</table>
					<div class="page-nav f12">{echo:$withdraw->pagebar()}</div>
				</div>
				
			</div>
		</div>
	</div>
</div>




<script type="text/javascript">
function go_back_sell(obj,id)
{
	if(confirm('确定要执行此操作吗?'))
	{
		$(obj).attr('disabled', true);
		$.post("{url:/ucenter/go_back_sell}",{id:id},function(data){
			if(data['status'] == 'success')
			{
				art.dialog({id:'withdraw-dialog'}).close();
				art.dialog.tips("<p class='"+data['status']+"'>"+data['msg']+"</p>",2);
        		setTimeout("tools_reload()",2000);
				window.location.href = "{url:/ucenter/my_transaction}";
			}
			else
			{
				alert(data['msg']);
				$(obj).attr('disabled', false);
			}
			
		},'json');
	}
	else
	{
		return false;	
	}
}
/*
	$("#recharge-btn").on("click",function() {
		art.dialog({id:'recharge-dialog',title:'在线充值',content:document.getElementById('recharge-dialog'),lock:true});
	});
	$("#withdraw-btn").on("click",function() {
		art.dialog({id:'withdraw-dialog',title:'提现申请',content:document.getElementById('withdraw-dialog'),lock:true});
	});
	$("#zh-btn").on("click",function() {
		art.dialog({id:'zh-dialog',title:'币种转换',content:document.getElementById('zh-dialog'),lock:true});
	});
	$("#zz-btn").on("click",function() {
	art.dialog({id:'zz-dialog',title:'转账',content:document.getElementById('zz-dialog'),lock:true});
});
	function close_dialog(e){
		if(!e)art.dialog({id:'recharge-dialog'}).close();
	}
	function submit_withdraw(e){
		if(!e){
			var name = $("#w_name").val();
			var type_name = $("#w_type_name").val();
			var account = $("#w_account").val();
			var amount = $("#w_amount").val();
			var pass2 = $("#pass2").val();
			$.get("{url:/ucenter/withdraw}",{name:name,type_name:type_name,pass2:pass2,account:account,amount:amount},function(data){
				if(data['status']=='success'){
					art.dialog({id:'withdraw-dialog'}).close();
					art.dialog.tips("<p class='"+data['status']+"'>"+data['msg']+"</p>",2);
            		setTimeout("tools_reload()",2000);
					window.location.href = "{url:/ucenter/account/rand/}"+Math.random()+"#tab-3";
				}else{
					alert(data['msg']);
				}
			},'json');
		}
		return false;
	}
	function submit_zh(e){
		if(!e){
			var zh_get = $("#zh_get").val();
			var zh_from = $("#zh_from").val();
			var pass2 = $("#pass2").val();
			var amount = $("#amount").val();
			$.get("{url:/ucenter/zh}",{zh_get:zh_get,zh_from:zh_from,pass2:pass2,amount:amount},function(data){
				if(data['status']=='success'){
					art.dialog({id:'zh-dialog'}).close();
					art.dialog.tips("<p class='"+data['status']+"'>"+data['msg']+"</p>",2);
            		setTimeout("tools_reload()",2000);
					window.location.href = "{url:/ucenter/account/rand/}"+Math.random()+"#tab-2";
				}else{
					alert(data['msg']);
				}
			},'json');
		}
		return false;
	}
	function submit_zz(e){
	if(!e){
		var fields = $("#zz_form").serializeArray();
		$.get("{url:/ucenter/zz}",fields,function(data){
			if(data['status']=='success'){
				art.dialog({id:'zz-dialog'}).close();
				art.dialog.tips("<p class='"+data['status']+"'>"+data['msg']+"</p>",2);
            setTimeout("tools_reload()",2000);
            window.location.href = "{url:/ucenter/account/rand/}"+Math.random()+"#tab-1";
			}else{
				alert(data['msg']);
			}
		},'json');
	}
	return false;
}
	*/
</script>
